package com.boluo.web.controller.businessManagement;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.boluo.businessManagement.dto.BusMentStoreDTO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.boluo.common.annotation.Log;
import com.boluo.common.core.controller.BaseController;
import com.boluo.common.core.domain.AjaxResult;
import com.boluo.common.enums.BusinessType;
import com.boluo.businessManagement.domain.BusMentStore;
import com.boluo.businessManagement.service.IBusMentStoreService;
import com.boluo.common.utils.poi.ExcelUtil;
import com.boluo.common.core.page.TableDataInfo;

/**
 * 仓库信息Controller
 * 
 * @author boluo
 * @date 2023-05-02
 */
@RestController
@RequestMapping("/businessManagement/store")
public class BusMentStoreController extends BaseController
{
    @Autowired
    private IBusMentStoreService busMentStoreService;

    /**
     * 查询仓库信息列表 不分页
     */
    @PreAuthorize("@ss.hasPermi('businessManagement:store:list')")
    @GetMapping("/listNoPage")
    public AjaxResult listNoPage(BusMentStoreDTO busMentStoreDTO)
    {

        List<BusMentStore> list = busMentStoreService.selectBusMentStoreList(busMentStoreDTO);
        return AjaxResult.success(list);
    }

    /**
     * 查询仓库信息列表
     */
    @PreAuthorize("@ss.hasPermi('businessManagement:store:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusMentStoreDTO busMentStoreDTO)
    {
        startPage();
        List<BusMentStore> list = busMentStoreService.selectBusMentStoreList(busMentStoreDTO);
        return getDataTable(list);
    }



    /**
     * 获取仓库信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('businessManagement:store:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(busMentStoreService.selectBusMentStoreById(id));
    }

    /**
     * 新增仓库信息
     */
    @PreAuthorize("@ss.hasPermi('businessManagement:store:add')")
    @Log(title = "仓库信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusMentStore busMentStore)
    {
        return toAjax(busMentStoreService.insertBusMentStore(busMentStore));
    }

    /**
     * 修改仓库信息
     */
    @PreAuthorize("@ss.hasPermi('businessManagement:store:edit')")
    @Log(title = "仓库信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusMentStore busMentStore)
    {
        return toAjax(busMentStoreService.updateBusMentStore(busMentStore));
    }

    /**
     * 删除仓库信息
     */
    @PreAuthorize("@ss.hasPermi('businessManagement:store:remove')")
    @Log(title = "仓库信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(busMentStoreService.deleteBusMentStoreByIds(id));
    }
}
